<?php

/**
 * Category form.
 *
 * @package    saf
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class inputAssetMultiple extends sfInputAssets
{

    protected function configure($options = array(), $attributes = array())
    {
        $this->addOption('with_delete', true);
    }

    public function render($name, $values = null, $attributes = array(), $errors = array())
    {

        $multi_id = $this->generateId( $name );
        use_javascript  ( '/sfAssetsLibraryPlugin/js/main.js' );
        use_stylesheet  ( '/sfAssetsLibraryPlugin/css/main.css' );
        $html = link_to ( 'Add asset '.image_tag('/sfAssetsLibraryPlugin/images/image_add.png') , 'sfAsset/addAssetRowAjax' ,array('onclick'=>'return add_asset_image(this);' , 'id'=>'multi_asset_'.$multi_id , 'widget_name'=> $name ) ).'<hr>' ;

        //$i = 0;
        $html .= "<ul id='assets_contaier_multi_asset_{$multi_id}'>";
        if ( is_array($values) && count($values) > 0 ) {
            foreach ($values as $value){
                $i     = $value;
                $html .= "<li class='asset-li asset-li-{$i}' value='{$i}' >";
                $html .= parent::render( $name.'['.$i.']' , $value , $attributes , $errors );
                $html .= "</li>";
            }
        }
        $html .= "</ul>";
        return $html;
    }








}
